#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os


def listcomp01():
    return [x * x for x in range(1, 11)]


def listcomp02():
    return [x * x for x in range(1, 11) if x % 2 == 0]


def listcomp03():  # 两重循环的列表生成式
    [m + n for m in 'ABC' for n in 'XYZ']


def listdirs():
    return [d for d in os.listdir('.')]


def listdic(): # dic类型的列表生成式
    d = {'x': 'A', 'y': 'B', 'z': 'C'}
    return [k + '=' + v for k, v in d.iteritems()]


if __name__ == '__main__':
    print listcomp01()
    print listcomp02()
    print listcomp03()
    print listdirs()
    print listdic()
